gtk_widget_destroy (view);
}
+static void
+abort_cb (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ g_assert_not_reached ();
+}
+
+static void
+test_selection_empty (void)
+{
+ GtkTreePath *path;
+ GtkListStore *list_store;
+ GtkTreeSelection *selection;
+ GtkWidget *view;
+ GtkTreeIter iter;
+
+ g_test_bug ("712760");
+
+ list_store = gtk_list_store_new (1, G_TYPE_STRING);
+ view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+
+ g_assert_false (gtk_tree_selection_get_selected (selection, NULL, &iter));
+ gtk_tree_selection_selected_foreach (selection, abort_cb, NULL);
+ g_assert_null (gtk_tree_selection_get_selected_rows (selection, NULL));
+ g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
+
+ path = gtk_tree_path_new_from_indices (0, -1);
+
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_selection_unselect_path (selection, path);
+ g_assert_false (gtk_tree_selection_path_is_selected (selection, path));
+
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+
+ gtk_tree_selection_select_all (selection);
+ g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
+
+ gtk_tree_selection_unselect_all (selection);
+ g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
+
+ gtk_tree_selection_select_range (selection, path, path);
+ g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
+
+ gtk_tree_selection_unselect_range (selection, path, path);
+ g_assert_cmpint (gtk_tree_selection_count_selected_rows (selection), ==, 0);
+
+ gtk_tree_path_free (path);
+
+ gtk_widget_destroy (view);
+}
+
int
main (int argc,
char **argv)
g_test_add_func ("/TreeView/sizing/row-separator-height",
test_row_separator_height);
g_test_add_func ("/TreeView/selection/count", test_selection_count);
+ g_test_add_func ("/TreeView/selection/empty", test_selection_empty);
return g_test_run ();
}